1

I am developing a web application in Phoenix and I also just started discovering Unix process management.

I put my app in background, like this:

vagrant@dev:/srv/my_app$ iex -S mix phoenix.server &
[1] 8726

Then I'd like to cd to another directory and do some other work in the main prompt. However, as soon as I do that, the background process stops.

vagrant@dev:/srv/my_app$ cd ..

[1]+  Stopped                 iex -S mix phoenix.server  (wd: /srv/my_app)

I noticed this happens only in this particular case, because it's a prompt. It doesn't happen with other non-interactive processes (I'm free to change directory and all of that).

I tried the same with irb, another prompt, and I get exactly the same behavior.

Why is this happening, and is there any workaround for having a prompt in the background and change directory without it being stopped?

countermode
  • 7,533
  • 5
  • 31
  • 58
Simone
  • 113
  • 4

1 Answers1

2

Your shell didn't stop, the progress you sent to the background did (the iex process). If you hit "Enter" you'll get a shell prompt back.

John
  • 17,011
  • 1
    Actually what I want is the iex job to not stop, not the original shell prompt. The thing is, the iex process is both a job and a prompt. What I'm trying to achieve is to have the iex job running in background, but the iex prompt stopped (so that I can continue using the main shell prompt). Hope that makes sense. Anyway I realise this is kind of weird, so from now on I'll just run mix phoenix.server in the background, which doesn't spawn another prompt. – Simone Sep 14 '16 at 16:18