[JIRA] (JENKINS-48803) Powershell under linux have changed the command to pwsh

9 views
Skip to first unread message

onodera@mail.ru (JIRA)

unread,
Nov 27, 2018, 7:03:01 AM11/27/18
to jenkinsc...@googlegroups.com
Alexey Marin commented on Bug JENKINS-48803
 
Re: Powershell under linux have changed the command to pwsh

Discussing in this PR shows it's dangerous to use "isUnix()" to choose the binary. Plus, there are Windows Server distributions that only have pwsh.exe. What if the plugin actually exposed two commands?

powershell 'gci .' //launches Windows PowerShell
pwsh 'gci .' //launches PowerShell Core

The only drawback I see is you won't be able to have a truly cross-platform pipeline unless you install PowerShell Core on all your Windows agents. Alternative solution: keep only one command and:

  • if the system is detected as Unix, use `which pwsh` and then `which powershell` to check for the correct binary
  • if the system is detected as Windows, use `where.exe pwsh` and then `where.exe powershell` to check for the correct binary
Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

onodera@mail.ru (JIRA)

unread,
Nov 27, 2018, 7:03:01 AM11/27/18
to jenkinsc...@googlegroups.com
Alexey Marin edited a comment on Bug JENKINS-48803
Discussing in this PR shows it's dangerous to use "isUnix()" to choose the binary. Plus, there are Windows Server distributions that only have pwsh.exe. What if the plugin actually exposed two commands?
{code:java}

powershell 'gci .' //launches Windows PowerShell
pwsh 'gci .' //launches PowerShell Core
{code}

The only drawback I see is you won't be able to have a truly cross-platform pipeline unless you install PowerShell Core on all your Windows agents. Alternative solution: keep only one command and:
* if the system is detected as Unix, use `which pwsh` and then `which powershell` to check for the correct binary
* if the system is detected as Windows, use `where.exe pwsh
.exe ` and then `where.exe powershell .exe ` to check for the correct binary

josephp90@gmail.com (JIRA)

unread,
Nov 1, 2019, 12:55:03 PM11/1/19
to jenkinsc...@googlegroups.com
Joseph Petersen resolved as Fixed
 

Released as 2.35

Jenkins / Bug JENKINS-48803
Change By: Joseph Petersen
Status: Open Resolved
Assignee: Liam Leane Joseph Petersen
Resolution: Fixed
Released As: https://github.com/jenkinsci/workflow-durable-task-step-plugin/blob/workflow-durable-task-step-2.35/CHANGELOG.md#235
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo

josephp90@gmail.com (JIRA)

unread,
Nov 1, 2019, 12:57:01 PM11/1/19
to jenkinsc...@googlegroups.com

josephp90@gmail.com (JIRA)

unread,
Nov 1, 2019, 1:14:03 PM11/1/19
to jenkinsc...@googlegroups.com

josephp90@gmail.com (JIRA)

unread,
Mar 7, 2020, 1:07:32 AM3/7/20
to jenkinsc...@googlegroups.com
Joseph Petersen assigned an issue to Joseph Petersen
 
Change By: Joseph Petersen
Assignee: Joseph Petersen (old)
This message was sent by Atlassian Jira (v7.13.12#713012-sha1:6e07c38)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages