-
Notifications
You must be signed in to change notification settings - Fork 91
qt-build-utils can invoke qmake when it is a script #1284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,8 @@ | |
// | ||
// SPDX-License-Identifier: MIT OR Apache-2.0 | ||
|
||
use std::process::Command; | ||
|
||
/// Whether apple is the current target | ||
pub(crate) fn is_apple_target() -> bool { | ||
std::env::var("TARGET") | ||
|
@@ -14,3 +16,16 @@ pub(crate) fn is_apple_target() -> bool { | |
pub(crate) fn is_emscripten_target() -> bool { | ||
std::env::var("CARGO_CFG_TARGET_OS") == Ok("emscripten".to_owned()) | ||
} | ||
|
||
/// Wrap a command in a native subshell | ||
pub(crate) fn native_shell_command(command: &str) -> Command { | ||
let mut result: Command; | ||
if cfg!(target_os = "windows") { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we do this at build time with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ahayzen-kdab I actually prefer sticking with With There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess, just elsewhere where we have similar things they are at compile time and in theory CI picks up any Windows failures :-) But sure we can keep it this way for now... |
||
result = Command::new("cmd"); | ||
result.args(["/C", command]); | ||
} else { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please use an |
||
result = Command::new("sh"); | ||
result.args(["-c", command]); | ||
} | ||
result | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe passing the command as a plain string here will fail if the path to qmake contains a space.
As this path is provided by the user, we must ensure this works as well.
Please make sure that we can handle paths with spaces.
I suggest adding a testcase for this by adding a
test scripts/
folder that contains aqmake.sh
andqmake.bat
script that just echo a string or forward toqmake
.