{"action":"created","issue":{"url":"https://api.github.com/repos/saleyn/erlexec/issues/54","labels_url":"https://api.github.com/repos/saleyn/erlexec/issues/54/labels{/name}","comments_url":"https://api.github.com/repos/saleyn/erlexec/issues/54/comments","events_url":"https://api.github.com/repos/saleyn/erlexec/issues/54/events","html_url":"https://github.com/saleyn/erlexec/issues/54","id":110525059,"number":54,"title":"Any incoming message while waiting for sync subprocess treated as error","user":{"login":"nwalker","id":200176,"avatar_url":"https://avatars.githubusercontent.com/u/200176?v=3","gravatar_id":"","url":"https://api.github.com/users/nwalker","html_url":"https://github.com/nwalker","followers_url":"https://api.github.com/users/nwalker/followers","following_url":"https://api.github.com/users/nwalker/following{/other_user}","gists_url":"https://api.github.com/users/nwalker/gists{/gist_id}","starred_url":"https://api.github.com/users/nwalker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nwalker/subscriptions","organizations_url":"https://api.github.com/users/nwalker/orgs","repos_url":"https://api.github.com/users/nwalker/repos","events_url":"https://api.github.com/users/nwalker/events{/privacy}","received_events_url":"https://api.github.com/users/nwalker/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-10-08T19:28:58Z","updated_at":"2016-01-29T00:08:23Z","closed_at":null,"body":"```\r\n(kerl:r17) ~/p/erlexec (master|✔)                                                                                                                                       \r\n> erl -pa ebin\r\nErlang/OTP 17 [erts-6.4] [source] [64-bit] [smp:8:8] [async-threads:10] [kernel-poll:false]\r\n\r\nEshell V6.4  (abort with ^G)\r\n1> application:start(exec).\r\nok\r\n2> application:which_applications().\r\n[{exec,\"OS Process Manager\",\"v1.0-156-g05edfd2\"},\r\n {stdlib,\"ERTS  CXC 138 10\",\"2.4\"},\r\n {kernel,\"ERTS  CXC 138 10\",\"3.2\"}]\r\n3> spawn(fun () -> io:format(\"~p~n\", [exec:run(\"sleep 3 && echo done\", [sync, stdout])]) end) ! test.\r\ntest\r\n{error,[{reason,test}]}\r\n```\r\nAs I can see, there is a [clause in exec:wait_for_ospid_exit](https://github.com/saleyn/erlexec/blob/master/src/exec.erl#L724-L725) which treats any incoming message as an error message. Are you sure this behaviour is correct?\r\n"},"comment":{"url":"https://api.github.com/repos/saleyn/erlexec/issues/comments/176490148","html_url":"https://github.com/saleyn/erlexec/issues/54#issuecomment-176490148","issue_url":"https://api.github.com/repos/saleyn/erlexec/issues/54","id":176490148,"user":{"login":"0xNaN","id":1616416,"avatar_url":"https://avatars.githubusercontent.com/u/1616416?v=3","gravatar_id":"","url":"https://api.github.com/users/0xNaN","html_url":"https://github.com/0xNaN","followers_url":"https://api.github.com/users/0xNaN/followers","following_url":"https://api.github.com/users/0xNaN/following{/other_user}","gists_url":"https://api.github.com/users/0xNaN/gists{/gist_id}","starred_url":"https://api.github.com/users/0xNaN/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/0xNaN/subscriptions","organizations_url":"https://api.github.com/users/0xNaN/orgs","repos_url":"https://api.github.com/users/0xNaN/repos","events_url":"https://api.github.com/users/0xNaN/events{/privacy}","received_events_url":"https://api.github.com/users/0xNaN/received_events","type":"User","site_admin":false},"created_at":"2016-01-29T00:08:23Z","updated_at":"2016-01-29T00:08:23Z","body":"Hi, I'm dealing with what I think could be a strange behaviour (but I'm not really sure though!) and I think could be linked to this issue.\r\nWhen running a process without linking to it and then killing it in a sync way, works without problems:\r\n```\r\n(3334@workstation)1> exec:run(\"sleep 100\", []).\r\n{ok,<0.105.0>,19393}\r\n(3334@workstation)2> exec:run(\"kill 19393\", [sync]).\r\n{ok,[]}\r\n```\r\nBut if the shell `trap_exit` and the first process is linked to it:\r\n\r\n```\r\n(3334@workstation)3> process_flag(trap_exit, true). \r\nfalse\r\n(3334@workstation)4> exec:run_link(\"sleep 100\", []).\r\n{ok,<0.110.0>,19686}\r\n(3334@workstation)5> exec:run(\"kill 19686\", [sync]).\r\n{error,[{reason,{'EXIT',<0.110.0>,{exit_status,15}}}]}\r\n(3334@workstation)6> flush().\r\nShell got {'DOWN',#Ref<0.0.2.167>,process,<0.112.0>,normal}\r\nok\r\n(3334@workstation)7> \r\n```\r\nthe `kill` process on `5>` dies with an error that is the `EXIT` of the `sleep` process (that I expected to trap) while the shell traps a `DOWN` (which I think became from the iternal of  `5>`);\r\n\r\nWhat I'm expecting is that `5>` evaluates simply to `{ok,[]}` ( since `kill` exits with `0`) and the shell traps the `EXIT` message.\r\n\r\nI'm missing something?"}}