example showcase: use a more cross-platform friendly timer
This commit is contained in:
		
							parent
							
								
									fa9348fe2b
								
							
						
					
					
						commit
						9e12031a6b
					
				| @ -1,15 +1,15 @@ | |||||||
| #!/bin/bash | #!/bin/bash | ||||||
| 
 | 
 | ||||||
| duration='2' | duration='2' | ||||||
|  | function wait_seconds() { perl -e 'alarm shift; exec @ARGV' "$@"; } | ||||||
| run_example() { | run_example() { | ||||||
|     cargo build --example $1 |     cargo build --example $1 | ||||||
|     timeout "$duration" cargo run --example $1 |     wait_seconds "$duration" cargo run --example $1 | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| example_list="$(cargo build --example 2>&1)" | example_list="$(cargo build --example 2>&1)" | ||||||
| example_list=${example_list//$'\n'/} | example_list=${example_list//$'\n'/} | ||||||
| example_list="${example_list#error\: \"--example\" takes one argument.Available examples\: }" | example_list="${example_list#error\: \"--example\" takes one argument.Available examples\: }" | ||||||
| 
 |  | ||||||
| echo $example_list | echo $example_list | ||||||
| for example in $example_list | for example in $example_list | ||||||
| do | do | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 carter
						carter