{"action":"opened","issue":{"url":"https://api.github.com/repos/PowerShell/PowerShell/issues/2930","repository_url":"https://api.github.com/repos/PowerShell/PowerShell","labels_url":"https://api.github.com/repos/PowerShell/PowerShell/issues/2930/labels{/name}","comments_url":"https://api.github.com/repos/PowerShell/PowerShell/issues/2930/comments","events_url":"https://api.github.com/repos/PowerShell/PowerShell/issues/2930/events","html_url":"https://github.com/PowerShell/PowerShell/issues/2930","id":197590252,"number":2930,"title":"Will invoking of external bash command throw exception?","user":{"login":"jianglibo","id":27719,"avatar_url":"https://avatars.githubusercontent.com/u/27719?v=3","gravatar_id":"","url":"https://api.github.com/users/jianglibo","html_url":"https://github.com/jianglibo","followers_url":"https://api.github.com/users/jianglibo/followers","following_url":"https://api.github.com/users/jianglibo/following{/other_user}","gists_url":"https://api.github.com/users/jianglibo/gists{/gist_id}","starred_url":"https://api.github.com/users/jianglibo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jianglibo/subscriptions","organizations_url":"https://api.github.com/users/jianglibo/orgs","repos_url":"https://api.github.com/users/jianglibo/repos","events_url":"https://api.github.com/users/jianglibo/events{/privacy}","received_events_url":"https://api.github.com/users/jianglibo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-12-26T13:51:43Z","updated_at":"2016-12-26T13:51:43Z","closed_at":null,"body":"The lines bellow should catch an exception?\r\nI had wrote Powershell for months, It's not Powershell way.\r\n\r\n```\r\ntry {\r\n  \"/opt/oozie-build/oozie/bin/mkdistro.sh -DskipTests >/tmp/tmpJylOol.tmp 2>&1\" | Invoke-Expression\r\n}\r\n catch {\r\n            $Error | Write-HostIfInTesting\r\n }\r\n\r\nOr\r\n\r\ntry {\r\n  \"/opt/oozie-build/oozie/bin/mkdistro.sh -DskipTests\" | Invoke-Expression\r\n}\r\n catch {\r\n            $Error | Write-HostIfInTesting\r\n }\r\n```\r\n\r\nEven invoke code like this, it won't throw an exception. Does Powershell handle Java thread special?\r\n```\r\ntry { \"bash xx\" | Invoke-Expression} catch { \"yyy\"}\r\n```\r\n"}}
{"actor":{"display_login":"jianglibo"}}