{"action":"created","issue":{"url":"https://api.github.com/repos/maxogden/electron-packager/issues/232","labels_url":"https://api.github.com/repos/maxogden/electron-packager/issues/232/labels{/name}","comments_url":"https://api.github.com/repos/maxogden/electron-packager/issues/232/comments","events_url":"https://api.github.com/repos/maxogden/electron-packager/issues/232/events","html_url":"https://github.com/maxogden/electron-packager/issues/232","id":125320767,"number":232,"title":"Child process output issue for certain cli commands","user":{"login":"otakustay","id":639549,"avatar_url":"https://avatars.githubusercontent.com/u/639549?v=3","gravatar_id":"","url":"https://api.github.com/users/otakustay","html_url":"https://github.com/otakustay","followers_url":"https://api.github.com/users/otakustay/followers","following_url":"https://api.github.com/users/otakustay/following{/other_user}","gists_url":"https://api.github.com/users/otakustay/gists{/gist_id}","starred_url":"https://api.github.com/users/otakustay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/otakustay/subscriptions","organizations_url":"https://api.github.com/users/otakustay/orgs","repos_url":"https://api.github.com/users/otakustay/repos","events_url":"https://api.github.com/users/otakustay/events{/privacy}","received_events_url":"https://api.github.com/users/otakustay/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-01-07T04:39:49Z","updated_at":"2016-01-07T19:35:31Z","closed_at":null,"body":"### Environment\r\n\r\n- electron-packager `5.2.0`\r\n- electron `0.35.4` (Problem exists also in `0.36.1`)\r\n- command `electron-packager . Electron-Issue --platform=darwin --arch=x64 --version=0.35.4 --out=releases --overwrite`\r\n- OS X 10.11.2\r\n\r\n### Introduction to issue\r\n\r\nThis is a weird issue, I have tried my best but failed to find any solution.\r\n\r\nThe issue can be reproduced when **ALL** conditions below matches:\r\n\r\n1. Use `child_process` module to execute `unrar` cli tool viewing files of a rar file\r\n2. The rar file has a file whose name contains  non-ASCII character, in my case I have some chinese characters\r\n3. The app is packaged with `electron-packager`\r\n\r\nThe code is simple as `main.js` is:\r\n\r\n```js\r\n'use strict';\r\n\r\nlet electron = require('electron');\r\nlet app = electron.app;\r\n\r\nlet start = () => {\r\n    let BrowserWindow = electron.BrowserWindow;\r\n    let mainWindow = new BrowserWindow({width: 800, height: 600});\r\n\r\n    let url = 'file://' + require('path').join(__dirname, 'index.html');\r\n    mainWindow.loadURL(url);\r\n};\r\n\r\napp.on('ready', start);\r\napp.on('window-all-closed', () => app.quit());\r\n```\r\n\r\nAnd my `index.html` is:\r\n\r\n```html\r\n<!DOCTYPE html>\r\n<html>\r\n<head>\r\n    <meta charse=\"utf-8\" />\r\n    <title>Electron Issue</title>\r\n</head>\r\n<body>\r\n    <h2>Command</h2>\r\n    <pre><code>./unrar lb ./Archive.rar</code></pre>\r\n    <h2>Output</h2>\r\n    <pre id=\"output\"></pre>\r\n    <script>\r\n        'use strict';\r\n\r\n        try {\r\n            let command = require('path').join(__dirname, 'unrar');\r\n            let archive = require('path').join(__dirname, 'Archive.rar');\r\n            let s = require('child_process').execSync(`${command} lb ${archive}`);\r\n            document.getElementById('output').innerText = s;\r\n        }\r\n        catch (ex) {\r\n            document.getElementById('output').innerText = ex;\r\n        }\r\n    </script>\r\n</body>\r\n</html>\r\n```\r\n\r\n### Execute in command line\r\n\r\nWhen the command is executed in terminal directly, it's output is correct:\r\n\r\n```shell\r\n~ unrar lb Archive.rar\r\n\r\nabc测试1.png\r\nbar中文.png\r\nfoo有标点，奇怪的东西.png\r\nxyz试试.png\r\n```\r\n\r\n### Run via electron\r\n\r\nWhen run the app use `electron Electron-Issue.app/Contents/Resources/app/` to start the app, it gives correct output:\r\n\r\n```\r\nCommand\r\n\r\n./unrar lb ./Archive.rar\r\nOutput\r\n\r\nabc测试1.png\r\nbar中文.png\r\nfoo有标点，奇怪的东西.png\r\nxyz试试.png\r\n```\r\n\r\n### Run app\r\n\r\nWhen doubleclick the `Electron-Issue.app`, it gives incorrect output:\r\n\r\n```\r\nCommand\r\n\r\n./unrar lb ./Archive.rar\r\nOutput\r\n\r\nabcbarfooxyz\r\n```\r\n\r\nWe can see just leading ASCII characters are printed, is seems for each filename, the output is missing when the first non-ASCII character is encountered, and the trailing `\\n` is also missing.\r\n\r\n### Other case\r\n\r\nIf the command is not `unrar lb`, the output is correct, e.g. `ls .` give correct output even we have files with non-ASCII name.\r\n\r\nso I don't know if this is an issue of `electron`, `electron-packager` or `unrar` cli, or how can I find where the problem sits.\r\n\r\nI can upload the packaged app (112MB) if needed.\r\n"},"comment":{"url":"https://api.github.com/repos/maxogden/electron-packager/issues/comments/169783477","html_url":"https://github.com/maxogden/electron-packager/issues/232#issuecomment-169783477","issue_url":"https://api.github.com/repos/maxogden/electron-packager/issues/232","id":169783477,"user":{"login":"maxogden","id":39759,"avatar_url":"https://avatars.githubusercontent.com/u/39759?v=3","gravatar_id":"","url":"https://api.github.com/users/maxogden","html_url":"https://github.com/maxogden","followers_url":"https://api.github.com/users/maxogden/followers","following_url":"https://api.github.com/users/maxogden/following{/other_user}","gists_url":"https://api.github.com/users/maxogden/gists{/gist_id}","starred_url":"https://api.github.com/users/maxogden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maxogden/subscriptions","organizations_url":"https://api.github.com/users/maxogden/orgs","repos_url":"https://api.github.com/users/maxogden/repos","events_url":"https://api.github.com/users/maxogden/events{/privacy}","received_events_url":"https://api.github.com/users/maxogden/received_events","type":"User","site_admin":false},"created_at":"2016-01-07T19:35:31Z","updated_at":"2016-01-07T19:35:31Z","body":"Wow very odd. Thank you for the detailed debugging information. I am not sure how to proceed either, but perhaps someone else has an idea"}}