{"action":"created","issue":{"url":"https://api.github.com/repos/marcelklehr/nodist/issues/173","repository_url":"https://api.github.com/repos/marcelklehr/nodist","labels_url":"https://api.github.com/repos/marcelklehr/nodist/issues/173/labels{/name}","comments_url":"https://api.github.com/repos/marcelklehr/nodist/issues/173/comments","events_url":"https://api.github.com/repos/marcelklehr/nodist/issues/173/events","html_url":"https://github.com/marcelklehr/nodist/issues/173","id":182817733,"number":173,"title":"SIGTERM code does not propagate well between layers","user":{"login":"osher","id":803101,"avatar_url":"https://avatars.githubusercontent.com/u/803101?v=3","gravatar_id":"","url":"https://api.github.com/users/osher","html_url":"https://github.com/osher","followers_url":"https://api.github.com/users/osher/followers","following_url":"https://api.github.com/users/osher/following{/other_user}","gists_url":"https://api.github.com/users/osher/gists{/gist_id}","starred_url":"https://api.github.com/users/osher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/osher/subscriptions","organizations_url":"https://api.github.com/users/osher/orgs","repos_url":"https://api.github.com/users/osher/repos","events_url":"https://api.github.com/users/osher/events{/privacy}","received_events_url":"https://api.github.com/users/osher/received_events","type":"User","site_admin":false},"labels":[{"id":8174225,"url":"https://api.github.com/repos/marcelklehr/nodist/labels/bug","name":"bug","color":"fc2929","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":17,"created_at":"2016-10-13T15:12:10Z","updated_at":"2016-12-05T15:22:04Z","closed_at":null,"body":"SIGTERM code does not propagate well between layers\n`C:\\Program Files (x86)\\Nodist\\bin\\node.exe` drops the ball with SIGTERM signals.\n\nAfter fiddling, here's a work around:\nWhen I set my env. var PATH to skip `nodist\\bin\\node.exe` it works as expected, \n(i.e. path includes: `C:\\Program Files (x86)\\Nodist;C:\\Program Files (x86)\\Nodist\\bin;`)\nwhere with the value provided by the installer - it does not work and the problem is reproduced.\n(i.e. path includes only: `C:\\Program Files (x86)\\Nodist\\bin;`)\n\nFull details bellow.\n\nOsher\n\n```\n> nodist -v\n0.8.4\n```\n\nwindows 10.\n\nI learnt that `nodist` is built like onion, where a process spawns a process with many pipes between.\nI'm not sure what's the role of each layer - but. here's the story:\n\nI'm working on a code-generator for web-servers.\nThe generator expects an open-api spec-file, and generates:\na) a project that answer mock replies\nb) test suite for the core parts\nc) end-to-end test suite that the server passes with mock replies that meet the spec.\nThen developers can enter the project and replace mocks with real logic, and keep tests passing.\n\nAnd I code the generator with with bdd, so I have an end-to-end test for the generator itself, that:\n1. use child_process.exec Run the generator with a given openapi-spec file\n2. use child_process.exec Run the generated unit-tests\n3. use child_process.exec to run the generated end-to-end tests in a mocha suite that:\n   \n   3.1. use a before-all hook to lunch the server using `child = child_process.spawn('node', ['server.js'],  { cwd: targetDir })`\n   3.2. fire all the generated requests using request/request\n   3.3. use an after-all hook to `child.kill('SIGTERM')` and collect the logs it emits through it's well-handled graceful shutdown.\n\nThen I noted that ever since I started to use nodist the server lunched for the generated end-to-end test in step 3.1 does not get the `SIGTERM` command.\nI wasted on it half a day trying to isolate the problem...\n\nTo make a long story short, I found the problem is based on the node-process that is started using the child_process.spawn comand. \nWhen I used absolute paths to **_concrete_** node version distributables - the child process heard the SIGTERM, and all was dandy. \n(i.e. - `spawn([\"c:\\\\node-dist\\\\node-v6.5.0-win-x64\\\\node.exe\",...`)\nBut when I just used `child_process.spawn('node'...` - the problem was reproduced.\n\nI almost gave up on nodist and moved to use my own simple repository of node versions, but on the last moment I noted there's `node.exe` in many places:\n- nodist\\bin\\node.exe\n- nodist\\node.exe\n- nodist\\v-x64<ver>\\node.exe\n\n(Now I also assume that they call each other in this order)\n\nSo I decided to try absolute path to concrete version from the nodist\\v-x64. and it worked.\n(i.e. - `spawn([\"C:\\\\Program Files (x86)\\\\Nodist\\\\v-x64\\\\6.5.0\\\\node.exe\",...`)\nI tried absolute path to `nodist\\node.exe` - and it worked.\nI tired absolute path to `nodist\\bin\\node.exe` - and the problem was reproduced, the same way as it behaved when I `spawn([\"node\", ...`.\n\nI went to check my PATH variable.\nI kept the code with `spawn([\"node\", ...` - i.e. - let the OS seach for `node` in %PATH%.\n\nWhen I set my env. var PATH to skip `nodist\\bin\\node.exe` it works,\n(i.e. path includes: `C:\\Program Files (x86)\\Nodist;C:\\Program Files (x86)\\Nodist\\bin;`)\nwhere with the value provided by the installer - the problem is reproduced.\n(i.e. path includes only: `C:\\Program Files (x86)\\Nodist\\bin;`)\n"},"comment":{"url":"https://api.github.com/repos/marcelklehr/nodist/issues/comments/264881770","html_url":"https://github.com/marcelklehr/nodist/issues/173#issuecomment-264881770","issue_url":"https://api.github.com/repos/marcelklehr/nodist/issues/173","id":264881770,"user":{"login":"osher","id":803101,"avatar_url":"https://avatars.githubusercontent.com/u/803101?v=3","gravatar_id":"","url":"https://api.github.com/users/osher","html_url":"https://github.com/osher","followers_url":"https://api.github.com/users/osher/followers","following_url":"https://api.github.com/users/osher/following{/other_user}","gists_url":"https://api.github.com/users/osher/gists{/gist_id}","starred_url":"https://api.github.com/users/osher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/osher/subscriptions","organizations_url":"https://api.github.com/users/osher/orgs","repos_url":"https://api.github.com/users/osher/repos","events_url":"https://api.github.com/users/osher/events{/privacy}","received_events_url":"https://api.github.com/users/osher/received_events","type":"User","site_admin":false},"created_at":"2016-12-05T15:22:04Z","updated_at":"2016-12-05T15:22:04Z","body":"woups. sorry for the late response.\r\n\r\nAnyway, what I did was against the way nodist should be used, and by doing so I gave up some of it's abilities just to work around and get bye.\r\n\r\nI'm also not sure that you and I experience the same problem, so I can't really help 😢 "}}
{"actor":{"display_login":"osher"}}