Report an error when sdkid not found.
authorSebastien Douheret <sebastien.douheret@iot.bzh>
Tue, 4 Jul 2017 10:03:05 +0000 (12:03 +0200)
committerSebastien Douheret <sebastien.douheret@iot.bzh>
Tue, 4 Jul 2017 10:03:05 +0000 (12:03 +0200)
lib/apiv1/exec.go

index 654ff64..6c70a98 100644 (file)
@@ -177,6 +177,12 @@ func (s *APIService) execCmd(c *gin.Context) {
        if envCmd := s.sdks.GetEnvCmd(args.SdkID, prj.DefaultSdk); len(envCmd) > 0 {
                cmd = append(cmd, envCmd...)
                cmd = append(cmd, "&&")
+       } else {
+               // It's an error if no envcmd found while a sdkid has been provided
+               if args.SdkID != "" {
+                       common.APIError(c, "Unknown sdkid")
+                       return
+               }
        }
 
        cmd = append(cmd, "cd", prj.GetFullPath(args.RPath), "&&", args.Cmd)