File tree 2 files changed +14
-5
lines changed 2 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,9 @@ name = "pyenv-py"
3
3
version = " 0.2.2"
4
4
edition = " 2021"
5
5
6
+ [features ]
7
+ pythonw = []
8
+
6
9
[[bin ]]
7
10
name = " py"
8
11
path = " src/main.rs"
Original file line number Diff line number Diff line change @@ -180,13 +180,19 @@ fn main() {
180
180
. position ( |v| v. components ( ) . nth_back ( 1 ) . unwrap ( ) . as_os_str ( ) != "versions" ) ,
181
181
} ;
182
182
183
- let python_binary = match version_idx_opt {
183
+ let binary_name = if cfg ! ( feature = "pythonw" ) {
184
+ "pythonw"
185
+ } else {
186
+ "python"
187
+ } ;
188
+
189
+ let binary_path = match version_idx_opt {
184
190
Some ( version_idx) => find_binary_on_paths (
185
- "python" ,
191
+ binary_name ,
186
192
vec ! [ py_bin_locs[ version_idx] . to_owned( ) ] . into_iter ( ) ,
187
193
)
188
194
. unwrap_or_else ( || {
189
- eprintln ! ( "Unable to find python binary" ) ;
195
+ eprintln ! ( "Unable to find '{}' binary" , binary_name ) ;
190
196
process:: exit ( 1 ) ;
191
197
} ) ,
192
198
@@ -198,10 +204,10 @@ fn main() {
198
204
199
205
ctrlc:: set_handler ( move || { } ) . expect ( "Unable to set Ctrl-C handler" ) ;
200
206
201
- let status = Command :: new ( python_binary )
207
+ let status = Command :: new ( binary_path )
202
208
. args ( py_call_args)
203
209
. status ( )
204
- . expect ( "Unable to execute the binary" ) ;
210
+ . unwrap_or_else ( |_| panic ! ( "Unable to execute '{}' binary" , binary_name ) ) ;
205
211
206
212
exit_with_child_status ( status) ;
207
213
}
You can’t perform that action at this time.
0 commit comments