mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
fmt: replace go with spawn
This commit is contained in:
@@ -19,7 +19,7 @@ fn (mut app App) index() vweb.Result {
|
||||
}
|
||||
|
||||
fn test_send_a_request_to_homepage_expecting_a_csrf_cookie() {
|
||||
go vweb.run_at(&App{}, vweb.RunParams{ port: sport })
|
||||
spawn vweb.run_at(&App{}, vweb.RunParams{ port: sport })
|
||||
time.sleep(500 * time.millisecond)
|
||||
res := http.get('http://localhost:$sport/')?
|
||||
if res.header.str().contains('__Host-Csrf-Token') {
|
||||
|
||||
@@ -46,7 +46,7 @@ fn test_a_simple_vweb_app_runs_in_the_background() {
|
||||
eprintln('running:\n$server_exec_cmd')
|
||||
}
|
||||
$if windows {
|
||||
go os.system(server_exec_cmd)
|
||||
spawn os.system(server_exec_cmd)
|
||||
} $else {
|
||||
res := os.system(server_exec_cmd)
|
||||
assert res == 0
|
||||
|
||||
@@ -33,7 +33,7 @@ fn main() {
|
||||
assert http_port > 0
|
||||
timeout := os.args[2].int()
|
||||
assert timeout > 0
|
||||
go exit_after_timeout(timeout)
|
||||
spawn exit_after_timeout(timeout)
|
||||
//
|
||||
shared config := &Config{
|
||||
max_ping: 50
|
||||
@@ -108,7 +108,7 @@ pub fn (mut app App) shutdown() vweb.Result {
|
||||
if session_key != 'superman' {
|
||||
return app.not_found()
|
||||
}
|
||||
go app.gracefull_exit()
|
||||
spawn app.gracefull_exit()
|
||||
return app.ok('good bye')
|
||||
}
|
||||
|
||||
|
||||
@@ -433,7 +433,7 @@ pub fn run_at<T>(global_app &T, params RunParams) ! {
|
||||
eprintln('accept() failed with error: $err.msg()')
|
||||
continue
|
||||
}
|
||||
go handle_conn<T>(mut conn, mut request_app, routes)
|
||||
spawn handle_conn<T>(mut conn, mut request_app, routes)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ struct Article {
|
||||
}
|
||||
|
||||
fn test_a_vweb_application_compiles() {
|
||||
go fn () {
|
||||
spawn fn () {
|
||||
time.sleep(2 * time.second)
|
||||
exit(0)
|
||||
}()
|
||||
|
||||
Reference in New Issue
Block a user