5 个版本
0.2.0 | 2022年7月25日 |
---|---|
0.1.3 | 2022年7月24日 |
0.1.2 | 2022年7月23日 |
0.1.1 | 2022年7月23日 |
0.1.0 | 2022年7月23日 |
898 在 Unix API 中
每月下载 22 次
18KB
139 行
catp
打印 运行进程 的输出
catp 0.2.0
Print the output of a running process
USAGE:
catp [OPTIONS] <PID>
ARGS:
<PID> PID of the process to print
OPTIONS:
-h, --help Print help information
-v, --verbose Print more verbose information to stderr
-V, --version Print version information
为什么
有时进程被重定向到 /dev/null
,因为我们不期望检查其输出。然而,我们可能后悔这个决定,不希望重新启动进程。
或者我们根本不知道正在运行的进程在哪里打印。
那么就输入 catp
!
工作原理
catp
使用 ptrace
截获系统调用并从系统调用 write
中提取数据。因此,它应该适用于大多数应用程序。由于它会减慢系统调用,可能会影响对 I/O 敏感的应用程序的性能。
catp
需要运行 ptrace
权限,在大多数系统中意味着 root。
平台
目前仅支持 x86_64 Linux。
依赖项
~4.5MB
~95K SLoC