Jump to content




Run programm in background


  • You cannot reply to this topic
8 replies to this topic

#1 Wilma456

  • Members
  • 187 posts
  • LocationGermany

Posted 20 June 2016 - 03:56 PM

How can I run a programm invisible in background? Multishell has a tab, but I dont want to see that programm. The programm in background use the modem API to connect with other computers and has no output.

#2 ReBraLaCC

  • Members
  • 100 posts
  • LocationSublime Text 2

Posted 20 June 2016 - 04:10 PM

Well, you could always just make it a function as what you say gives no outputs, and maybe use [CODE]parallel.waitForAll()[\CODE]


#3 Sewbacca

  • Members
  • 450 posts
  • LocationStar Wars

Posted 20 June 2016 - 04:47 PM

local program = loadfile('myPrograms/program')
local shell = loadfile('rom/programs/shell')
parallel.waitForAll(shell, program)


#4 ReBraLaCC

  • Members
  • 100 posts
  • LocationSublime Text 2

Posted 20 June 2016 - 06:06 PM

View PostSewbacca, on 20 June 2016 - 04:47 PM, said:

local program = loadfile('myPrograms/program')
local shell = loadfile('rom/programs/shell')
parallel.waitForAll(shell, program)

^^ what i meant :)

#5 H4X0RZ

  • Members
  • 1,315 posts
  • LocationGermany

Posted 20 June 2016 - 07:25 PM

View PostReBraLaCC, on 20 June 2016 - 06:06 PM, said:

View PostSewbacca, on 20 June 2016 - 04:47 PM, said:

local program = loadfile('myPrograms/program')
local shell = loadfile('rom/programs/shell')
parallel.waitForAll(shell, program)

^^ what i meant :)

That would create a shell instance on top of your shell instance -> lag. If you have access to multishell, just create a new tab and run the program in there. If you don't, first exit the current shell (maybe even a TLCO) and then "restart" the terminated coroutines + your custom ones. Maybe turn it into a coroutine manager so you can add/remove coroutines later on too.

#6 ReBraLaCC

  • Members
  • 100 posts
  • LocationSublime Text 2

Posted 21 June 2016 - 08:20 AM

View PostH4X0RZ, on 20 June 2016 - 07:25 PM, said:

coroutine

and how so those wor?

#7 Sewbacca

  • Members
  • 450 posts
  • LocationStar Wars

Posted 21 June 2016 - 11:58 AM

View PostH4X0RZ, on 20 June 2016 - 07:25 PM, said:

View PostReBraLaCC, on 20 June 2016 - 06:06 PM, said:

View PostSewbacca, on 20 June 2016 - 04:47 PM, said:

local program = loadfile('myPrograms/program')
local shell = loadfile('rom/programs/shell')
parallel.waitForAll(shell, program)

^^ what i meant :)

That would create a shell instance on top of your shell instance -> lag. If you have access to multishell, just create a new tab and run the program in there. If you don't, first exit the current shell (maybe even a TLCO) and then "restart" the terminated coroutines + your custom ones. Maybe turn it into a coroutine manager so you can add/remove coroutines later on too.

If you want to prevent an instance of the shell, then you have to edit the ROM, because all code is running just in one direction, so it is impossible to stop upper programs with code. Shell.exit() just stop the shell, after closing the last program (try it with lua), so creating an instance of the shell is the best alternate of running programs with the multishell. Also it is impossible to restart coroutines if you haven't the function.

Edited by Sewbacca, 21 June 2016 - 11:58 AM.


#8 Wilma456

  • Members
  • 187 posts
  • LocationGermany

Posted 21 June 2016 - 12:02 PM

Im working on a OS and I don't want to see the multishell tabs in my GUI. They destroy my GUI and doesent look good. They user can code his own programm for the OS and the programmm, who send and listen the modem must run every time in background.

#9 H4X0RZ

  • Members
  • 1,315 posts
  • LocationGermany

Posted 21 June 2016 - 01:12 PM

View PostSewbacca, on 21 June 2016 - 11:58 AM, said:

View PostH4X0RZ, on 20 June 2016 - 07:25 PM, said:

View PostReBraLaCC, on 20 June 2016 - 06:06 PM, said:

View PostSewbacca, on 20 June 2016 - 04:47 PM, said:

local program = loadfile('myPrograms/program')
local shell = loadfile('rom/programs/shell')
parallel.waitForAll(shell, program)

^^ what i meant :)/>/>

That would create a shell instance on top of your shell instance -> lag. If you have access to multishell, just create a new tab and run the program in there. If you don't, first exit the current shell (maybe even a TLCO) and then "restart" the terminated coroutines + your custom ones. Maybe turn it into a coroutine manager so you can add/remove coroutines later on too.

If you want to prevent an instance of the shell, then you have to edit the ROM, because all code is running just in one direction, so it is impossible to stop upper programs with code. Shell.exit() just stop the shell, after closing the last program (try it with lua), so creating an instance of the shell is the best alternate of running programs with the multishell. Also it is impossible to restart coroutines if you haven't the function.

You can. Look at the Top Level Coroutine Override (TLCO). Basically let's you run code at BIOS level.

The only coroutines ran by the BIOS are an instance of shell/multishell and rednet.run . You can easily "restart" them.

Edited by H4X0RZ, 21 June 2016 - 01:14 PM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users