File tree Expand file tree Collapse file tree 4 files changed +31
-32
lines changed
Expand file tree Collapse file tree 4 files changed +31
-32
lines changed Original file line number Diff line number Diff line change @@ -10,12 +10,10 @@ jobs:
1010 linux :
1111 runs-on : ubuntu-latest
1212 steps :
13- - uses : actions/checkout@v2
14- - uses : actions-rs/ toolchain@v1
13+ - uses : actions/checkout@v4
14+ - uses : actions-rust-lang/setup-rust- toolchain@v1
1515 with :
16- toolchain : stable
1716 components : rustfmt, clippy
18- - run : sudo -E `which cargo` test -j`nproc` - - --test-threads 1
19- - run : sudo -E `which cargo` test -j`nproc` - - --ignored --test-threads 1
17+ - run : sudo -E `which cargo` test -- --test-threads 1
18+ - run : sudo -E `which cargo` test -- --ignored --test-threads 1
2019 - run : sudo -E `which cargo` fmt -- --check
21- - run : sudo -E `which cargo` clippy -j`nproc`
Original file line number Diff line number Diff line change 1+ name : Publish to Crates.io
2+ on :
3+ push :
4+ tags :
5+ - ' v*'
6+ jobs :
7+ publish :
8+ runs-on : ubuntu-latest
9+ steps :
10+ - uses : actions/checkout@v4
11+ - uses : actions-rust-lang/setup-rust-toolchain@v1
12+ - run : cargo login ${{ secrets.CRATES_IO_TOKEN }}
13+ - run : cargo package
14+ - run : cargo publish
15+ release :
16+ runs-on : ubuntu-latest
17+ needs : [publish]
18+ permissions :
19+ contents : write
20+ packages : write
21+ steps :
22+ - uses : actions/checkout@v4
23+ - name : create release
24+ run : gh release create "${{ github.ref_name }}" -t "${{ github.ref_name }}"
25+ env :
26+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change @@ -10,12 +10,11 @@ license = "MIT"
1010name = " iptables"
1111readme = " README.md"
1212repository = " https://github.com/yaa110/rust-iptables"
13- version = " 0.5.3 "
13+ version = " 0.5.4 "
1414
1515[lib ]
1616name = " iptables"
1717
1818[dependencies ]
1919lazy_static = " 1"
20- nix = {version = " 0.29" , features = [" fs" ]}
2120regex = " 1"
Original file line number Diff line number Diff line change @@ -18,7 +18,6 @@ pub mod error;
1818
1919use error:: IptablesError ;
2020use lazy_static:: lazy_static;
21- use nix:: fcntl:: { FlockArg , flock} ;
2221use regex:: { Match , Regex } ;
2322use std:: convert:: From ;
2423use std:: error:: Error ;
@@ -407,38 +406,15 @@ impl IPTables {
407406 }
408407
409408 fn run < S : AsRef < OsStr > > ( & self , args : & [ S ] ) -> Result < Output , Box < dyn Error > > {
410- let mut file_lock = None ;
411-
412409 let mut output_cmd = Command :: new ( self . cmd ) ;
413410 let output;
414411
415412 if self . has_wait {
416413 output = output_cmd. args ( args) . arg ( "--wait" ) . output ( ) ?;
417414 } else {
418- file_lock = Some ( File :: create ( "/var/run/xtables_old.lock" ) ?) ;
419-
420- let mut need_retry = true ;
421- while need_retry {
422- match flock (
423- file_lock. as_ref ( ) . unwrap ( ) . as_raw_fd ( ) ,
424- FlockArg :: LockExclusiveNonblock ,
425- ) {
426- Ok ( _) => need_retry = false ,
427- Err ( e) if e == nix:: errno:: Errno :: EAGAIN => {
428- // FIXME: may cause infinite loop
429- need_retry = true ;
430- }
431- Err ( e) => {
432- return Err ( Box :: new ( e) ) ;
433- }
434- }
435- }
436415 output = output_cmd. args ( args) . output ( ) ?;
437416 }
438417
439- if let Some ( f) = file_lock {
440- drop ( f)
441- }
442418 Ok ( output)
443419 }
444420}
You can’t perform that action at this time.
0 commit comments