You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CrazyFanFan opened this issue
Jul 25, 2023
· 4 comments
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.clonedResolution: Was resubmitted in the appropriate repository rather than transferred
When using the Process.run() method to execute a command, the command fails to execute completely and the program terminates prematurely. The issue is observed when executing the following Swift code:
print("enter")lettask=tryProcess.run(URL(fileURLWithPath:"/usr/bin/script"), arguments:"-aq /dev/null bash -c ls".components(separatedBy:"")){ process inprint(process.terminationStatus)}
task.waitUntilExit()print("leave")
The expected behavior is that the ls command should be executed successfully and the program should print "enter", the termination status of the process, and "leave" in the console.
Steps to reproduce
Copy the above Swift code into a main.swift.
Call swift main.swift
Observe that the program terminates prematurely after printing "enter" and the termination status of the process.
Expected behavior
The ls command should be executed successfully and the program should print "enter", the termination status of the process, and "leave" in the console.
Note:
The issue appears to be related to the use of the /usr/bin/script command with the -aq options. Removing these options or using a different command appears to resolve the issue.
Environment
Swift compiler version info
swift-driver version: 1.85 Apple Swift version 5.9 (swiftlang-5.9.0.120.7 clang-1500.0.34.3)
Target: arm64-apple-macosx14.0
Xcode version info
Build version 15A5195m
Deployment target:
14.0 Beta (23A5286i)
The text was updated successfully, but these errors were encountered:
CrazyFanFan
added
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
triage needed
This issue needs more specific labels
labels
Jul 25, 2023
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.clonedResolution: Was resubmitted in the appropriate repository rather than transferred
Description
When using the Process.run() method to execute a command, the command fails to execute completely and the program terminates prematurely. The issue is observed when executing the following Swift code:
The expected behavior is that the ls command should be executed successfully and the program should print "enter", the termination status of the process, and "leave" in the console.
Steps to reproduce
swift main.swift
Expected behavior
The ls command should be executed successfully and the program should print "enter", the termination status of the process, and "leave" in the console.
Note:
The issue appears to be related to the use of the /usr/bin/script command with the -aq options. Removing these options or using a different command appears to resolve the issue.
Environment
The text was updated successfully, but these errors were encountered: