课程: Go Essentials: Concurrency, Connectivity, and High-Performance Apps

今天就学习课程吧!

今天就开通帐号,24,700 门业界名师课程任您挑!

Challenge: Server kill

Challenge: Server kill

(bright music) - [Instructor] Services, or servers, usually store their process ID in a file. When you want to terminate the service, you need to read this process ID from the file and then terminate the service. You need to write a function called killServer. It should read the process ID from the file, convert it from a string to an integer, and finally, print out killing the server with process ID. You need to think about error handling and what to do in each case of an error. And then, in the main function, you're going to call the killServer with server.pid, and if there is an error, print out the error to standard error.

内容