tools.ps.windows: If we can't read the process command-line args, just
ignore the error. Fixes #1788.factor-shell
parent
9c8648334a
commit
6ddeeac3dc
|
@ -1,9 +1,9 @@
|
||||||
USING: accessors alien alien.c-types alien.data alien.syntax
|
USING: accessors alien alien.c-types alien.data alien.syntax
|
||||||
arrays byte-arrays classes.struct destructors fry io
|
arrays byte-arrays classes.struct combinators.short-circuit
|
||||||
io.encodings.string io.encodings.utf16n kernel literals locals
|
continuations destructors fry io io.encodings.string
|
||||||
math sequences strings system tools.ps
|
io.encodings.utf16n kernel literals locals math sequences
|
||||||
windows.errors windows.handles windows.kernel32 windows.ntdll
|
strings system tools.ps windows.errors windows.handles
|
||||||
windows.types ;
|
windows.kernel32 windows.ntdll windows.types ;
|
||||||
IN: tools.ps.windows
|
IN: tools.ps.windows
|
||||||
|
|
||||||
: do-snapshot ( snapshot-type -- handle )
|
: do-snapshot ( snapshot-type -- handle )
|
||||||
|
@ -82,11 +82,17 @@ IN: tools.ps.windows
|
||||||
[ <win32-handle> &dispose drop ]
|
[ <win32-handle> &dispose drop ]
|
||||||
[ first-process ]
|
[ first-process ]
|
||||||
[ '[ drop _ next-process ] follow ] tri
|
[ '[ drop _ next-process ] follow ] tri
|
||||||
|
[
|
||||||
[
|
[
|
||||||
[ th32ProcessID>> ]
|
[ th32ProcessID>> ]
|
||||||
[ th32ProcessID>> open-process-read dup [ read-args ] when ]
|
[ th32ProcessID>> open-process-read dup [ read-args ] when ]
|
||||||
[ szExeFile>> [ 0 = ] trim-tail >string or ] tri 2array
|
[ szExeFile>> [ 0 = ] trim-tail >string or ] tri 2array
|
||||||
] map
|
] [
|
||||||
|
! Reading the arguments can fail
|
||||||
|
! Win32 error 0x12b: Only part of a ReadProcessMemory or WriteProcessMemory request was completed.
|
||||||
|
dup { [ windows-error? ] [ n>> 0x12b = ] } 1&& [ 2drop f ] [ rethrow ] if
|
||||||
|
] recover
|
||||||
|
] map sift
|
||||||
] with-destructors ;
|
] with-destructors ;
|
||||||
|
|
||||||
M: windows ps ( -- assoc ) process-list ;
|
M: windows ps ( -- assoc ) process-list ;
|
||||||
|
|
Loading…
Reference in New Issue