Skip to content

Commit

Permalink
Fixed issues while downloading code in zip format
Browse files Browse the repository at this point in the history
  • Loading branch information
namanjain-iitr committed Apr 29, 2021
1 parent d97e4c1 commit ceba9e9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include <string.h>
#include <iostream>

#include <sys/wait.h>
#include <../include/color.hpp>

using namespace std;
Expand All @@ -13,7 +12,6 @@ void print_git_branch();

void print_input_format()
{
wait(NULL);
cout << flush;

char hostname[50];
Expand Down Expand Up @@ -49,19 +47,21 @@ void print_git_branch()
// Get current branch and save its name in a file.
fp = popen("git branch --show-current 2>/dev/null", "r");

if (fp == NULL)
if (fp == NULL){
pclose(fp);
return;
}

// Read branch name and print current branch name
fgets(branch_name, 200, fp);
branch_name[strcspn(branch_name, "\n")] = 0;

// Should check status if any error occurs
pclose(fp);

if (branch_name && strcmp(branch_name, "") == 0)
return;

// print current branch name in red enclosed in round braces
cout << RED << " (" << branch_name << ")" << RESET;

// Should check status if any error occurs
pclose(fp);
}

0 comments on commit ceba9e9

Please sign in to comment.