shirou
83427f964f
[process][darwin]: skip process.Nice test if darwin on GitHub Action
...
fix: https://github.com/shirou/gopsutil/issues/1532
1 year ago
Matthieu MOREL
c806740b34
ci(lint): ensure io/ioutil replacement ( #1525 )
...
* ci(lint): enure ioutil replacement
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
* Update host_solaris.go
* Update process_linux_test.go
* Update net_linux_test.go
* Update net_linux_test.go
* Update process_test.go
* Update process_linux_test.go
* Update process_linux_test.go
---------
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2 years ago
shirou
0665cafa1b
chore: replace deprecated ioutil package to os and io
2 years ago
shirou
febdeab871
chore: change CIRCLECI environment variable to CI.
2 years ago
Antoine Toulme
6fff1c0e99
proper benchmark
2 years ago
Antoine Toulme
ca71a6db3c
lint
2 years ago
Antoine Toulme
4bc9e37b0f
faster file read
2 years ago
Lomanic
8b96d2e9e2
[process][posix] Realign process.Name() with python psutil to return same value on python3 scripts processes
...
e2c79a1
started to blindly set the process name to the full path (instead of the basename) of the cmdline exectuable
if the process name from the process comm was truncated on linux. Python psutil never did that, and this is just wrong
for python (or any executable interpreted script) where the process name is not the interpreter binary but the script
itself.
A new test to check process name value against psutil value is added here, which would hopefully catch any potential
future changes in psutil.
Reverts #542
Fixes #1485
2 years ago
Lomanic
c0f3eb1dfb
[process] Remove all noisy and useless Test_AllProcesses_X tests
...
These tests can't fail more than their invidiual counterparts and produce an incredibly verbose output
2 years ago
Matthieu MOREL
1fb1e3e3e6
ci(lint): correct gci linter
...
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2 years ago
Lomanic
980cc82c08
[process][windows] Retrieve process name as basename of executable
...
We align ourself with psutil
8e4099d9f0/psutil/_pswindows.py (L749-L759)
Benchmarks show vast improvements
go test -run=BenchmarkProcessName -bench=BenchmarkProcessName ./process
goos: windows
goarch: amd64
pkg: github.com/shirou/gopsutil/v3/process
cpu: Intel(R) Core(TM) i5-6300U CPU @ 2.40GHz
BenchmarkProcessName-4 180 6564033 ns/op
BenchmarkProcessNameViaExe-4 22111 51153 ns/op
PASS
ok github.com/shirou/gopsutil/v3/process 3.914s
Fixes #1368
2 years ago
Pierre Fersing
60eae48e6a
Drop test for Darwin Pids()
3 years ago
mmorel-35
1e6b445a8a
gofumpt
3 years ago
Matthieu MOREL
b673968d5d
enable errorlint linter
3 years ago
shirou
d2e27c1712
fix dependabot v2 deletion.
3 years ago
shirou
0969c9436b
delete v2 directory, move v3 to top #1078
3 years ago
shirou
0ce33dbe64
Merge pull request #1166 from easyops-cn/kestrel/process
...
feat(process): implement the 'OpenFilesWithContext' function of the windows system
3 years ago
kestrelcjx
5832fdfb9b
chore(process): open file in process test case
3 years ago
Max Altgelt
a4679b798b
feat: Add support for Cwd() on Windows
3 years ago
shirou
7be7e7807f
[process] extend maxElapsedTime on process_test
4 years ago
Tom Barker
9248140c98
Wait for server connection to be established before checking
...
connections.
4 years ago
Tom Barker
bc4661937d
Minor cleanups motivated by staticcheck warnings.
4 years ago
Tom Barker
5ce887df8f
Make sure that Test_AllProcesses_cmdLine doesn't ignore failures.
4 years ago
Tom Barker
34cdfa258b
Test_Connections currently fails intermittently on Linux (and maybe
...
other OSs), and fails consistently if run with `go test -times=N`
On inspection, Go closes TCP connections when they go out of scope and
are garbage collected. I've re-written Test_Connections() to explicitly
close connectections once the test has finished. This has the other
benefit of closing gracefully, which means the -times argument should
work.
I've also removed the t.Skip() calls inside goroutines as they are
unsupported.
4 years ago
Max Altgelt
73fee847e6
chore: add tests
...
Add simple tests to verify that environment variables are read.
4 years ago
Max Altgelt
b02b92e16b
feat: Add support for environment variable read
...
Add support (for Linux and Windows for now) for reading the
environment variables of a process, with a similar syntax to
os.Environ().
For Windows, this includes some refactoring for clean access to the
RTL_USER_PROCESS_PARAMETERS structure which points to the command
line and the environment variables.
4 years ago
John Blesener
e8b2bea47f
Fix spaces on long process names for MacOS
4 years ago
Lomanic
995610e109
[process][windows] Fix Nice() test expecting Unix values
4 years ago
Lomanic
eaa34817d0
[process] Add benchmarks for New(), Name() Ppid()
...
run only them with: go test -bench=. -run=xxx github.com/shirou/gopsutil/process
5 years ago
Lomanic
64ba9d03cd
[process] Properly test Ppid() against known value
5 years ago
Lomanic
1b3e0c6643
[linux] Fix #900 , skip or fix failing tests in docker
...
TestGetProcInodesAll: create a server so there are some opened inodes
TestUsers: skip if Users is empty, because of an empty /var/run/utmp
Test_Process_Groups: skip if Groups is empty
TestConnectionsMax: skip on CI, not only CircleCI
5 years ago
shirou
7e94bb8bcd
Merge pull request #775 from TakayukiBGoto/add_additional_gids_support
...
[Process] Implement Groups() to get additional gids.
5 years ago
Mauro Leggieri
00957cfedc
Fixed slow command line retrieval on Windows
5 years ago
Lomanic
e7090ba9fc
[process] Fix Test_Children test regression because of some other running test
5 years ago
Lomanic
1fcea92f73
[process] Skip if not implemented Test_IsRunning (for openbsd)
5 years ago
Lomanic
e4f087a4af
[process] Test process.Name() with long names #795
5 years ago
TakayukiB Goto
9c6cedb822
[Process] Fix typo
5 years ago
TakayukiB Goto
f55f202e81
[Process] Implement Groups() to get additional gids.
6 years ago
Lomanic
547679f88e
[process] Fix #760 implement IsRunning by checking process with same PID has same CreateTime as current process
6 years ago
Lomanic
f09ba75b25
[process] Skip tests on non-implemented platforms #446 and fix Kill/Children tests on windows
6 years ago
Lomanic
f49203762b
[process] Fix Connections() test with goroutines listening/connecting on TCP
6 years ago
mingrammer
64a995aad4
Refactor with gofmt
6 years ago
mingrammer
017c9f9cbc
Fix typos
6 years ago
shirou
a33a26bd97
Merge pull request #567 from tagirb/grouped_memorymaps
...
implement grouped memorymaps output
6 years ago
Iskander Sharipov
f3d4342c30
cpu,process: remove commented-out code
...
Found using https://go-critic.github.io/overview#commentedOutCode-ref
7 years ago
Tagir Bakirov
29b3c3719b
fix slice indices
7 years ago
Tagir Bakirov
47166d6a81
implement grouped memorymaps output
7 years ago
Michal Rostecki
91ac1d66ac
process: Check for error objects
7 years ago
shirou
d1fb05a30b
Skip some test if CircleCI.
7 years ago
WAKAYAMA shirou
f5e19d7e16
[process]windows: implements process.Kill using os/exec
7 years ago