Jump to content
Sign in to follow this  
Dru89

Shell Scripts in Workflows Can't Fork Processes

Recommended Posts

Please post one thread per bug report with the following information:

  • What you were doing when the issue happened
  • Whether you were able to replicate it a second time by performing the same action
  • Include any screenshots that might help us
  • Include the Alfred version & build number you are using
  • Include your OS X version

I was trying to create a workflow earlier that basically looked like this:
 

killall synergys
nohup /usr/local/bin/synergys -f -c ~/.synergy/synergy.conf -d ERROR &
ssh -f -R 24800:127.0.0.1:24800 <myhostname> -- 'killall synergyc; synergyc -d ERROR -f 127.0.0.1'

Basically, what this command should do, line-by-line is:

  • Kill all instances of synergys running on my machine.
  • Start a synergys process on my machine, with a given configuration, log level, and then fork the process.
  • ssh into my other desktop, with a little tunneling magic, kill all instances of the synergy client running on it, and start it back up by connecting through the tunnel that I created.

This works if I have it as a script on my desktop and run it, but I wanted to have an Alfred workflow that also posted a little notification when it was done.

 

So my workflow looks like this:

 

Input ('syn' keyword) => Script => Notification

When it gets to the script, it doesn't seem to execute line two correctly.  I've tried inserting each command line-by-line to see where it breaks, and it looks like it's not able to fork the process.  Whenever I run the command with just lines 1 and 2 and run a ps auxwww | grep synergys to see how it looks, the process is not showing up in the results.

 

I think I can "fix" this by having Alfred call a separate file, but it doesn't seem to be working as is.

 

Other information:

Alfred version: v2.0.3 (187)

Mac OS X Version: Mountain Lion (10.8.3)

 

I'm calling this a bug because if you're accepting shell scripts, I imagine it should be able to fork processes, but I can't figure out why it's not.

Share this post


Link to post

I'm calling this a bug because if you're accepting shell scripts, I imagine it should be able to fork processes, but I can't figure out why it's not.

 

This may be a consequence of NSTask and something Alfred won't be able to work around. You could possibly work around this by piping all output into dev null, which will allow the NSTask to return back to Alfred.

 

I'm moving this to noted as I may look into it later.

Share this post


Link to post
Sign in to follow this  
×
×
  • Create New...